<template>
    <div class="i-table-no-border">
        <Table ref="table" :columns="columns" :data="data" size="small">
            <template slot-scope="{ row }" slot="info">
                <a @click="handleDetail( row )"> {{ row.basic }}</a>
            </template>
            <template slot-scope="{ row }" slot="diagnosis">
                <Tag v-if="row.diagnosis === 0" color="blue">初诊</Tag>
                <Tag v-if="row.diagnosis === 1" color="volcano">复诊</Tag>
                <Tag v-if="row.diagnosis === 2" color="cyan">未及时复诊</Tag>
                <Tag v-if="row.diagnosis === 3" color="green">抗复发</Tag>
                <Tag v-if="row.diagnosis === 4" color="orange">流失</Tag>
                <Tag v-if="row.diagnosis === 5" color="red">断诊</Tag>
            </template>
            <template slot-scope="{ row }" slot="channel">
                <Badge v-if="row.channel === 0" status="success" text="微信" />
                <Badge v-if="row.channel === 1" status="processing" text="抖音" />
                <Badge v-if="row.channel === 2" status="error" text="市场转诊" />
                <Badge v-if="row.channel === 3" status="warning" text="自然到诊" />
            </template>
        </Table>
        <div class="ivu-mt iuv-text-center" slot="footer">
            <Page :total="100" show-elevator show-sizer show-total></Page>
        </div>
    </div>
</template>
<script>
    export default {
        data () {
            return {
                model11: '',
                styles: {
                    height: 'calc(100% - 55px)',
                    overflow: 'auto',
                    paddingBottom: '53px',
                    position: 'static'
                },
                labelPosition: 'left',
                columns: [
                    {
                        type: 'selection',
                        width: 50,
                        align: 'center',
                        fixed: 'left'
                    },
                    {
                        title: '基本信息',
                        key: 'basic',
                        slot: 'info',
                        minWidth: 150,
                        fixed: 'left'
                    },
                    {
                        title: '诊疗号',
                        key: 'consultant',
                        minWidth: 100
                    },
                    {
                        title: '诊室',
                        key: 'treatmentRoom',
                        minWidth: 100
                    },
                    {
                        title: '到诊时间',
                        key: 'AdvanceTime',
                        sortable: true,
                        minWidth: 150
                    },
                    // {
                    //     title: '电话',
                    //     key: 'phone',
                    //     minWidth: 150
                    // },
                    {
                        title: '微信号',
                        key: 'wx',
                        minWidth: 100
                    },
                    {
                        title: '就诊类型',
                        slot: 'diagnosis',
                        minWidth: 138
                    },
                    {
                        title: '复诊次数',
                        key: 'frequency',
                        sortable: true,
                        minWidth: 118
                    },
                    {
                        title: '回访次数',
                        key: 'numberVisits',
                        sortable: true,
                        minWidth: 128
                    },
                    {
                        title: '未到诊天数',
                        key: 'noArrived',
                        sortable: true,
                        minWidth: 128
                    },
                    {
                        title: '地区',
                        key: 'region',
                        minWidth: 100
                    },
                    {
                        title: '病种',
                        key: 'disease',
                        minWidth: 100
                    },
                    {
                        title: '来源',
                        minWidth: 120,
                        slot: 'channel'
                    },
                    {
                        title: '更新时间',
                        key: 'updateTime',
                        sortable: true,
                        minWidth: 150
                    }
                ],
                data: [
                    {
                        basic: '刘鸾英 女 26岁',
                        consultant: 13526587,
                        treatmentRoom: '三诊',
                        AdvanceTime: '2016-10-03',
                        phone: 13385658568,
                        wx: 'sky15258',
                        diagnosis: Math.floor(Math.random() * 5),
                        frequency: 3,
                        noArrived: 15,
                        numberVisits: 6,
                        region: '合肥',
                        disease: '白癜风',
                        channel: Math.floor(Math.random() * 3),
                        updateTime: '2016-10-08'
                    },
                    {
                        basic: '刘鸾英 女 26岁',
                        consultant: 13526587,
                        treatmentRoom: '三诊',
                        AdvanceTime: '2016-10-02',
                        phone: 13385658568,
                        wx: 'ss258',
                        diagnosis: Math.floor(Math.random() * 5),
                        frequency: 2,
                        noArrived: 265,
                        numberVisits: 8,
                        region: '合肥',
                        disease: '白癜风',
                        channel: Math.floor(Math.random() * 3),
                        updateTime: '2016-10-08'
                    }
                ]
            }
        },
        methods: {
            handleDetail (row) {
                this.$router.push('/patient/detailed')
            }
        }
    }
</script>
